//
//  YJRegisterViewController.swift
//  yuejian
//
//  Created by yanziye on 2017/10/9.
//  Copyright © 2017年 gyy. All rights reserved.
//

import UIKit
class YJRegisterViewController: UIViewController {
    
    
   
    
    @IBOutlet weak var tel: UITextField!

    @IBOutlet weak var password: UITextField!
    
    

//    
//    @IBOutlet weak var address: UITextField!
//    
//    @IBOutlet weak var comment: UITextField!
    
    @IBAction func submit(_ sender: UIButton) {
        
        if tel.text == "" {
            //print("用户名没有输入")
            MBProgressHUD.showDelayHUDToView(self.view, message: "联系电话没有输入")
        }
        else
        {
            if password.text == ""
            {
                MBProgressHUD.showDelayHUDToView(self.view, message: "密码没有输入")
                //print("密码没有输入")
                
            }
            else{
                
                let parameters:NSDictionary = ["tel": tel.text!, "password": password.text!]
                //print(parameters)
                YJNetworkMngTool.sharedNetWorkMngTool.YJNetwork_Register(parameters, view: self.view, block: {
                    (flag) in if flag == "1"
                    {
                        MBProgressHUD.showDelayHUDToView(self.view, message: "注册成功")
                        let _ = self.navigationController?.popViewController(animated: true)
                        print("注册成功")}
                    else{
                        MBProgressHUD.hide(for: self.view, animated: true)
                        print("注册失败")
                    }
                })
                
            }
            
            
            
        }
        
    }

    
    @IBAction func cancel(_ sender: UIButton) {
        
        let _ = self.navigationController?.popViewController(animated: true)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        
    }
    
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destinationViewController.
     // Pass the selected object to the new view controller.
     }
     */
    
}
